/**
 * @param {number[]} nums
 * @param {number} k
 * @return {void} Do not return anything, modify nums in-place instead.
 * @description 调用api 会超时
 */

var rotate = function (nums, k) {
    let len = nums.length
    k = k % len
    let arr = nums.splice(len - k, k)
    for (let i = arr.length - 1; i >= 0; i--) {
        nums.unshift(arr[i])
    }
    return nums
};
console.log(rotate([1, 2, 3, 4, 5, 6, 7], 3))